<?php namespace Zmsun\Http\Header;class Connection implements IHeader{const CONNECTION_CLOSE='close';const CONNECTION_KEEP_ALIVE='keep-alive';protected$value=self::CONNECTION_KEEP_ALIVE;public static function fromString($headerLine){$header=new static();list($name,$value)=GenericHeader::splitHeaderLine($headerLine);if(strtolower($name)!=='connection'){throw new \InvalidArgumentException('Invalid header line for Connection string: "'.$name.'"');}$header->setValue(trim($value));return$header;}public function setPersistent($flag){if((bool)$flag===true){$this->value=self::CONNECTION_KEEP_ALIVE;}else{$this->value=self::CONNECTION_CLOSE;}return$this;}public function isPersistent(){return($this->value===self::CONNECTION_KEEP_ALIVE);}public function setValue($value){$this->value=strtolower($value);return$this;}public function getFieldName(){return'Connection';}public function getFieldValue(){return$this->value;}public function toString(){return'Connection: '.$this->getFieldValue();}}